/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sistemabienes;

import com.sun.data.provider.DataProviderException;
import com.sun.data.provider.RowKey;
import com.sun.data.provider.TableDataAdapter;
import com.sun.data.provider.TableDataProvider;
import com.sun.data.provider.impl.CachedRowSetDataProvider;
import com.sun.rave.web.ui.appbase.AbstractPageBean;
import com.sun.webui.jsf.component.DropDown;
import com.sun.webui.jsf.component.Label;
import com.sun.webui.jsf.component.PanelGroup;
import com.sun.webui.jsf.component.TableRowGroup;
import com.sun.webui.jsf.component.TextArea;
import com.sun.webui.jsf.component.TextField;
import com.sun.webui.jsf.model.DefaultOptionsList;
import com.sun.webui.jsf.model.DefaultTableDataProvider;
import com.sun.webui.jsf.model.MultipleSelectOptionsList;
import com.sun.webui.jsf.model.SingleSelectOptionsList;
import java.io.IOException;
import java.sql.CallableStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.ParseException;
import javax.faces.FacesException;
import javax.faces.event.ValueChangeEvent;
import javax.faces.validator.LengthValidator;
import javax.faces.validator.LongRangeValidator;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
import javax.sql.rowset.spi.SyncProviderException;

/**
 * <p>Page bean that corresponds to a similarly named JSP page.  This
 * class contains component definitions (and initialization code) for
 * all components that you have defined on this page, as well as
 * lifecycle methods and event handlers where you may add behavior
 * to respond to incoming events.</p>
 *
 * @version GruposContables.java
 * @version Created on 05-10-2010, 03:31:41 PM
 * @author luis
 */

public class GruposContables extends AbstractPageBean {
    // <editor-fold defaultstate="collapsed" desc="Managed Component Definition">

    /**
     * <p>Automatically managed component initialization.  <strong>WARNING:</strong>
     * This method is automatically generated, so any user-specified code inserted
     * here is subject to being replaced.</p>
     */
    private void _init() throws Exception {
        cbdepDefaultOptions.setOptions(new com.sun.webui.jsf.model.Option[]{new com.sun.webui.jsf.model.Option("1", "verdad"), new com.sun.webui.jsf.model.Option("0", "falso")});
        cbactDefaultOptions.setOptions(new com.sun.webui.jsf.model.Option[]{new com.sun.webui.jsf.model.Option("1", "verdad"), new com.sun.webui.jsf.model.Option("0", "falso")});
        sesion_temp_gruposDataProvider.setCachedRowSet((javax.sql.rowset.CachedRowSet) getValue("#{SessionBean1.sesion_temp_gruposRowSet}"));
       this.getSessionBean1().select_temp_gruposDataProvider.setCachedRowSet((javax.sql.rowset.CachedRowSet) getValue("#{SessionBean1.select_temp_gruposRowSet}"));
        cbdepDefaultOptions.setSelectedValue("1");
        cbactDefaultOptions.setSelectedValue("1");
       /* select_temp_gruposDataProvider.addTableDataListener(new TableDataAdapter() {

            public void rowAdded(TableDataProvider tdp, RowKey rk) {
                select_temp_gruposDataProvider_rowAdded(tdp, rk);
            }
        });*/
    }
    private PanelGroup panel = new PanelGroup();

    public PanelGroup getPanel() {
        return panel;
    }

    public void setPanel(PanelGroup pg) {
        this.panel = pg;
    }
    private SingleSelectOptionsList cbdepDefaultOptions = new SingleSelectOptionsList();

    public SingleSelectOptionsList getCbdepDefaultOptions() {
        return cbdepDefaultOptions;
    }

    public void setCbdepDefaultOptions(SingleSelectOptionsList ssol) {
        this.cbdepDefaultOptions = ssol;
    }
    private SingleSelectOptionsList cbactDefaultOptions = new SingleSelectOptionsList();

    public SingleSelectOptionsList getCbactDefaultOptions() {
        return cbactDefaultOptions;
    }

    public void setCbactDefaultOptions(SingleSelectOptionsList ssol) {
        this.cbactDefaultOptions = ssol;
    }
    private TextArea txtareades = new TextArea();

    public TextArea getTxtareades() {
        return txtareades;
    }

    public void setTxtareades(TextArea ta) {
        this.txtareades = ta;
    }
    private TextField txtpartida = new TextField();

    public TextField getTxtpartida() {
        return txtpartida;
    }

    public void setTxtpartida(TextField tf) {
        this.txtpartida = tf;
    }
    private TextField txtdescp = new TextField();

    public TextField getTxtdescp() {
        return txtdescp;
    }

    public void setTxtdescp(TextField tf) {
        this.txtdescp = tf;
    }
    private TextField txtanyo = new TextField();

    public TextField getTxtanyo() {
        return txtanyo;
    }

    public void setTxtanyo(TextField tf) {
        this.txtanyo = tf;
    }
    private DropDown cbdep = new DropDown();

    public DropDown getCbdep() {
        return cbdep;
    }

    public void setCbdep(DropDown dd) {
        this.cbdep = dd;
    }
    private DropDown cbact = new DropDown();

    public DropDown getCbact() {
        return cbact;
    }

    public void setCbact(DropDown dd) {
        this.cbact = dd;
    }
    private TextField txtporcent = new TextField();

    public TextField getTxtporcent() {
        return txtporcent;
    }

    public void setTxtporcent(TextField tf) {
        this.txtporcent = tf;
    }
    private TextField txtmes = new TextField();

    public TextField getTxtmes() {
        return txtmes;
    }

    public void setTxtmes(TextField tf) {
        this.txtmes = tf;
    }
    private CachedRowSetDataProvider sesion_temp_gruposDataProvider = new CachedRowSetDataProvider();

    public CachedRowSetDataProvider getSesion_temp_gruposDataProvider() {
        return sesion_temp_gruposDataProvider;
    }

    public void setSesion_temp_gruposDataProvider(CachedRowSetDataProvider crsdp) {
        this.sesion_temp_gruposDataProvider = crsdp;
    }
    private TextField txtgrupo = new TextField();

    public TextField getTxtgrupo() {
        return txtgrupo;
    }

    public void setTxtgrupo(TextField tf) {
        this.txtgrupo = tf;
    }
    private TableRowGroup tableRowGroup2 = new TableRowGroup();

    public TableRowGroup getTableRowGroup2() {
        return tableRowGroup2;
    }

    public void setTableRowGroup2(TableRowGroup trg) {
        this.tableRowGroup2 = trg;
    }


    /*private CachedRowSetDataProvider select_temp_gruposDataProvider = new CachedRowSetDataProvider();

    public CachedRowSetDataProvider getSelect_temp_gruposDataProvider() {
        return select_temp_gruposDataProvider;
    }

    public void setSelect_temp_gruposDataProvider(CachedRowSetDataProvider crsdp) {
        this.select_temp_gruposDataProvider = crsdp;
    }*/
    private Label label2 = new Label();

    public Label getLabel2() {
        return label2;
    }

    public void setLabel2(Label l) {
        this.label2 = l;
    }
    private TableRowGroup tableRowGroup1 = new TableRowGroup();

    public TableRowGroup getTableRowGroup1() {
        return tableRowGroup1;
    }

    public void setTableRowGroup1(TableRowGroup trg) {
        this.tableRowGroup1 = trg;
    }
    private TableRowGroup tableRowGroup3 = new TableRowGroup();

    public TableRowGroup getTableRowGroup3() {
        return tableRowGroup3;
    }

    public void setTableRowGroup3(TableRowGroup trg) {
        this.tableRowGroup3 = trg;
    }
    private TextField txtgrupo1 = new TextField();

    public TextField getTxtgrupo1() {
        return txtgrupo1;
    }

    public void setTxtgrupo1(TextField tf) {
        this.txtgrupo1 = tf;
    }
    private TextArea txtareades1 = new TextArea();

    public TextArea getTxtareades1() {
        return txtareades1;
    }

    public void setTxtareades1(TextArea ta) {
        this.txtareades1 = ta;
    }
    // </editor-fold>

    /**
     * <p>Construct a new Page bean instance.</p>
     */
    public GruposContables() throws Exception {
        boolean us=this.getSessionBean1().isloged();

        if(us==false)
        {
            throw new Exception("Permiso denegado");

        }
    }

    /**
     * <p>Callback method that is called whenever a page is navigated to,
     * either directly via a URL, or indirectly via page navigation.
     * Customize this method to acquire resources that will be needed
     * for event handlers and lifecycle methods, whether or not this
     * page is performing post back processing.</p>
     * 
     * <p>Note that, if the current request is a postback, the property
     * values of the components do <strong>not</strong> represent any
     * values submitted with this request.  Instead, they represent the
     * property values that were saved for this view when it was rendered.</p>
     */
    @Override
    public void init() {
        // Perform initializations inherited from our superclass
        super.init();
     /*   panel.setVisible(false);
        txtareades.setDisabled(true);
        txtpartida.setDisabled(true);
        txtdescp.setDisabled(true);
        txtanyo.setDisabled(true);
        txtmes.setDisabled(true);
        txtporcent.setDisabled(true);*/
        // Perform application initialization that must complete
        // *before* managed components are initialized
        // TODO - add your own initialiation code here
        
        // <editor-fold defaultstate="collapsed" desc="Managed Component Initialization">
        // Initialize automatically managed components
        // *Note* - this logic should NOT be modified
        try {
            _init();
        } catch (Exception e) {
            log("GruposContables Initialization Failure", e);
            throw e instanceof FacesException ? (FacesException) e: new FacesException(e);
        }
        
        // </editor-fold>
        // Perform application initialization that must complete
        // *after* managed components are initialized
        // TODO - add your own initialization code here
    }

    /**
     * <p>Callback method that is called after the component tree has been
     * restored, but before any event processing takes place.  This method
     * will <strong>only</strong> be called on a postback request that
     * is processing a form submit.  Customize this method to allocate
     * resources that will be required in your event handlers.</p>
     */
    @Override
    public void preprocess() {
        txtareades1.setDisabled(false);
        txtareades.setDisabled(false);
    }

    /**
     * <p>Callback method that is called just before rendering takes place.
     * This method will <strong>only</strong> be called for the page that
     * will actually be rendered (and not, for example, on a page that
     * handled a postback and then navigated to a different page).  Customize
     * this method to allocate resources that will be required for rendering
     * this page.</p>
     */
    @Override
    public void prerender() {
        /*panel.setVisible(false);
        txtareades.setDisabled(true);
        txtpartida.setDisabled(true);
        txtdescp.setDisabled(true);
        txtanyo.setDisabled(true);
        txtmes.setDisabled(true);*/
        
    }

    /**
     * <p>Callback method that is called after rendering is completed for
     * this request, if <code>init()</code> was called (regardless of whether
     * or not this was the page that was actually rendered).  Customize this
     * method to release resources acquired in the <code>init()</code>,
     * <code>preprocess()</code>, or <code>prerender()</code> methods (or
     * acquired during execution of an event handler).</p>
     */
    @Override
    public void destroy() {
        this.getSessionBean1().select_temp_gruposDataProvider.close();
    }

    /**
     * <p>Return a reference to the scoped data bean.</p>
     *
     * @return reference to the scoped data bean
     */
    protected ApplicationBean1 getApplicationBean1() {
        return (ApplicationBean1) getBean("ApplicationBean1");
    }

    /**
     * <p>Return a reference to the scoped data bean.</p>
     *
     * @return reference to the scoped data bean
     */
    protected RequestBean1 getRequestBean1() {
        return (RequestBean1) getBean("RequestBean1");
    }

    /**
     * <p>Return a reference to the scoped data bean.</p>
     *
     * @return reference to the scoped data bean
     */
    protected SessionBean1 getSessionBean1() {
        return (SessionBean1) getBean("SessionBean1");
    }

    public void txtareades_processValueChange(ValueChangeEvent event) {
    }

    public void txtpartida_processValueChange(ValueChangeEvent event) {
    }

    public String btnguardargrupoc_action() throws NamingException, IOException, SQLException, ParseException {
        // TODO: Process the action. Return value is a navigation
        // case name where null will return to the same page.

         try {
            // TODO: Process the action. Return value is a navigation
            // case name where null will return to the same page.

            if (this.getSessionBean1().select_temp_gruposDataProvider.getRowCount() > 0) {
                this.getSessionBean1().select_temp_gruposDataProvider.cursorFirst();
                this.sesion_temp_gruposDataProvider.cursorFirst();
                //RowKey row=this.select_temp_gruposDataProvider.getCursorRow();
               do
                {
                    //String dp=select_temp_gruposDataProvider.getValue("COD_UFV",row).toString();
                            int keygrup=Integer.parseInt( this.getSessionBean1().select_temp_gruposDataProvider.getValue("keygrupo").toString());
                             String desc=this.getSessionBean1().select_temp_gruposDataProvider.getValue("descripcion").toString();
                            int part=Integer.parseInt( this.getSessionBean1().select_temp_gruposDataProvider.getValue("partida").toString());
                             String descp=this.getSessionBean1().select_temp_gruposDataProvider.getValue("descripcion_p").toString();
                             int any=Integer.parseInt(this.getSessionBean1().select_temp_gruposDataProvider.getValue("anyos").toString());
                             int se_dep=Integer.parseInt(this.getSessionBean1().select_temp_gruposDataProvider.getValue("se_deprecia").toString());
                            int se_act=Integer.parseInt( this.getSessionBean1().select_temp_gruposDataProvider.getValue("se_actualiza").toString());

                            String porce_anyo=this.getSessionBean1().select_temp_gruposDataProvider.getValue("porcent_anyo").toString();
                              float pa2 = Float.valueOf(porce_anyo.trim()).floatValue();


                             String porce_mes=this.getSessionBean1().select_temp_gruposDataProvider.getValue("porcent_mes").toString();
                              float pm2= Float.valueOf(porce_mes.trim()).floatValue();
                               
                              
                         //Se inserta al nuevo data provider sesiontemp;
                        boolean s[] = {true, true, true,true,true,true,true,true,true};
                        RowKey row2=this.sesion_temp_gruposDataProvider.appendRow();
                        this.getSessionBean1().getSesion_temp_gruposRowSet().setInsertableColumns(s);
                         this.sesion_temp_gruposDataProvider.setValue("keygrupo",row2, keygrup);
                         this.sesion_temp_gruposDataProvider.setValue("descripcion",row2, desc);
                         this.sesion_temp_gruposDataProvider.setValue("partida",row2, part);
                         this.sesion_temp_gruposDataProvider.setValue("descripcion_p",row2, descp);
                         this.sesion_temp_gruposDataProvider.setValue("anyos",row2, any);
                         this.sesion_temp_gruposDataProvider.setValue("se_deprecia",row2, se_dep);
                         this.sesion_temp_gruposDataProvider.setValue("se_actualiza",row2, se_act);

                         this.sesion_temp_gruposDataProvider.setValue("porcent_anyo",row2, pa2);

                         this.sesion_temp_gruposDataProvider.setValue("porcent_mes",row2, pm2);
                       
                                   //////////////////
                    } while (this.getSessionBean1().select_temp_gruposDataProvider.cursorNext());
                this.sesion_temp_gruposDataProvider.commitChanges();
                this.getSessionBean1().select_temp_gruposDataProvider.refresh();
                 this.sesion_temp_gruposDataProvider.refresh();
                 }
            

            //nb_testDataProvider.commitChanges();
        } catch (DataProviderException ex) {
            error(ex.getMessage());
            error(ex.getStackTrace().toString());
        }
           /*     ///////Borra elementos data provider
            if (select_temp_gruposDataProvider.getRowCount() > 0) {
                this.select_temp_gruposDataProvider.cursorFirst();
                RowKey rk=this.select_temp_gruposDataProvider.appendRow();
                do{
                            try{
                            
                            


                                    boolean data=select_temp_gruposDataProvider.canRemoveRow(rk);
                                    if(data== true)
                                    {select_temp_gruposDataProvider.removeRow(rk);
                                    select_temp_gruposDataProvider.commitChanges();
                                    select_temp_gruposDataProvider.refresh();
                                    }else
                                        error ("no se puede remover filas" );
                                    return null;
                                } catch (DataProviderException ex) {
                                        error(ex.getMessage());
                                        error(ex.getStackTrace().toString());
                        }
                   }while (select_temp_gruposDataProvider.cursorNext());
            }*/
    

        return null;
    }



    public String hyperlink1_action() {
        // TODO: Process the action. Return value is a navigation
        // case name where null will return to the same page.
        panel.setVisible(true);
        txtareades.setDisabled(false);
        txtpartida.setDisabled(false);
        txtdescp.setDisabled(false);
        txtanyo.setDisabled(false);
        txtmes.setDisabled(false);
        txtporcent.setDisabled(false);
        return null;
    }

    public String btncancelar_action() {
        // TODO: Process the action. Return value is a navigation
        // case name where null will return to the same page.
        //panel.setVisible(false);
          txtareades.setDisabled(true);
        txtpartida.setDisabled(true);
        txtdescp.setDisabled(true);
        txtanyo.setDisabled(true);
        txtmes.setDisabled(true);
        txtporcent.setDisabled(true);
        return null;
    }

    /*public String btborrarfila_action() {
        // TODO: Replace with your code
        RowKey rk = tableRowGroup2.getRowKey();
        sesion_temp_gruposDataProvider.canRemoveRow(rk);
        sesion_temp_gruposDataProvider.removeRow(rk);
        sesion_temp_gruposDataProvider.commitChanges();
        sesion_temp_gruposDataProvider.refresh();
        return null;
    }*/

    public String btagregar_action() throws NamingException, SQLException, ParseException, IOException {
        // TODO: Process the action. Return value is a navigation
        // case name where null will return to the same page.
         int keygrupo=Integer.parseInt(txtgrupo.getValue().toString());
        String txtaread =txtareades.getText().toString();
      int part=Integer.parseInt(txtpartida.getText().toString());
       String descrip = txtdescp.getText().toString();
      int anyo=Integer.parseInt(txtanyo.getText().toString());
       int depr=Integer.parseInt(cbdep.getValue().toString());
      int actual=Integer.parseInt(cbact.getValue().toString());

      String porcientanyo= txtporcent.getText().toString();
        String porcientmes= txtmes.getText().toString();
        boolean ver= insertagrupoc_temp(keygrupo, txtaread, part, descrip, anyo,depr,actual,porcientanyo, porcientmes);
       if(ver==true)
       {
           error("se inserto correctamente");
       }else
       {
            error("no se pudo insertar");
       }
        return null;

    }


public boolean insertagrupoc_temp (int keygrup,String descripg, int partida, String descripcionp,int anyo ,int sedeprecia,int seactual,String porcientanyo,String porcientmes) throws NamingException, SQLException,ParseException,IOException
    {

     //try{

    //Inserta mediante data provider
      this.getSessionBean1().select_temp_gruposDataProvider.cursorFirst();
      this.sesion_temp_gruposDataProvider.cursorFirst();
    boolean b[] = {true, true, true,true,true,true,true,true,true};
        RowKey row=this.getSessionBean1().select_temp_gruposDataProvider.appendRow();
        this.getSessionBean1().getSelect_temp_gruposRowSet().setInsertableColumns(b);
         this.getSessionBean1().select_temp_gruposDataProvider.setValue("keygrupo",row, keygrup);
         this.getSessionBean1().select_temp_gruposDataProvider.setValue("descripcion",row, descripg);
         this.getSessionBean1().select_temp_gruposDataProvider.setValue("partida",row, partida);
         this.getSessionBean1().select_temp_gruposDataProvider.setValue("descripcion_p",row, descripcionp);
         this.getSessionBean1().select_temp_gruposDataProvider.setValue("anyos",row, anyo);
         this.getSessionBean1().select_temp_gruposDataProvider.setValue("se_deprecia",row, sedeprecia);
         this.getSessionBean1().select_temp_gruposDataProvider.setValue("se_actualiza",row, seactual);
         float pa = Float.valueOf(porcientanyo.trim()).floatValue();
         this.getSessionBean1().select_temp_gruposDataProvider.setValue("porcent_anyo",row, pa);
         float pm= Float.valueOf(porcientmes.trim()).floatValue();
         this.getSessionBean1().select_temp_gruposDataProvider.setValue("porcent_mes",row, pm);
         this.getSessionBean1().select_temp_gruposDataProvider.commitChanges();
          this.getSessionBean1().select_temp_gruposDataProvider.refresh();
  ////
        
        // this.select_temp_gruposDataProvider.commitChanges();
         // this.getSessionBean1().sesion_temp_gruposRowSet.setDataSourceName("java:comp/env/jdbc/ACTIVOS_Oracle");
          //this.getSessionBean1().sesion_temp_gruposRowSet.setCommand("insert into activos.sesion_temp_grupos (keygrupo, descripcion, partida, descripcion_p, anyos, se_deprecia, se_actualiza, porcent_anyo, porcent_mes) values(?,?,?,?,?,?,?,?,?)");
         //this.getSessionBean1().sesion_temp_gruposRowSet.
        // this.getSessionBean1().sesion_temp_gruposRowSet.setCommand("insert into sesion_temp_grupos values(2,'terrenos',411,'terrenos',40,1,1,2.5,0.20); commit;");

           /* this.getSessionBean1().sesion_temp_gruposRowSet.setInt(1,keygrup );
           this.getSessionBean1().sesion_temp_gruposRowSet.setString(2, descripg);
                  this.getSessionBean1().sesion_temp_gruposRowSet.setInt(3, partida);
                  this.getSessionBean1().sesion_temp_gruposRowSet.setString(4, descripcionp);
                  this.getSessionBean1().sesion_temp_gruposRowSet.setInt(5, anyo);
                  this.getSessionBean1().sesion_temp_gruposRowSet.setInt(6, sedeprecia);
                  this.getSessionBean1().sesion_temp_gruposRowSet.setInt(7, seactual);
                   float pa = Float.valueOf(porcientanyo.trim()).floatValue();
                    
                   this.getSessionBean1().sesion_temp_gruposRowSet.setFloat(8, pa);
                  float pm= Float.valueOf(porcientmes.trim()).floatValue();
                    this.getSessionBean1().sesion_temp_gruposRowSet.setFloat(9, pm);*/

/*
            String dataSourceName=
                        this.getSessionBean1().getSelect_temp_gruposRowSet().getDataSourceName();
                 Context ctx= new InitialContext();
                 DataSource ds=(DataSource) ctx.lookup(dataSourceName);

                 //CallableStatement cs1 = ds.getConnection().prepareCall("CALL activos.temp_insertagrupoc(?,?,?,?,?,?,?,?,?)");
                 CallableStatement cs1 = ds.getConnection().prepareCall("insert into sesion_temp_grupos values(?,?,?,?,?,?,?,?,?)");
                 cs1.setInt(1,keygrup );
                  cs1.setString(2, descripg);
                  cs1.setInt(3, partida);
                  cs1.setString(4, descripcionp);
                  cs1.setInt(5, anyo);
                  cs1.setInt(6, sedeprecia);
                  cs1.setInt(7, seactual);
                   float pa = Float.valueOf(porcientanyo.trim()).floatValue();
                   cs1.setFloat(1,pa);
                  cs1.setFloat(8, pa);
                  float pm= Float.valueOf(porcientmes.trim()).floatValue();
                   cs1.setFloat(9, pm);
                 //int cod=Integer.parseInt(codufv);
                  //cs1.setInt(1,cod);
                // float v = Float.valueOf(valorufv.trim()).floatValue();
             //cs1.setFloat(2,v);


                cs1.executeQuery();
                //label3.setText(new java.sql.Date(fecha.getTime()));


                return true;
     }catch(SQLException e)
            {
                error(e.getMessage());

            }
     */
    return true;
    }

    public String btborrarfila_action() {
        // TODO: Process the action. Return value is a navigation
        // case name where null will return to the same page.
       
        try{
           this.getSessionBean1().select_temp_gruposDataProvider.cursorFirst();
          this.sesion_temp_gruposDataProvider.cursorFirst();
        RowKey rk = tableRowGroup1.getRowKey();

        boolean data=this.getSessionBean1().select_temp_gruposDataProvider.canRemoveRow(rk);
        if(data== true)
        {this.getSessionBean1().select_temp_gruposDataProvider.removeRow(rk);
        this.getSessionBean1().select_temp_gruposDataProvider.commitChanges();
       // this.getSessionBean1().select_temp_gruposDataProvider.refresh();
            this.getSessionBean1().select_temp_gruposDataProvider.cursorFirst();
        }else
            error ("no se puede remover filas" );
        return null;
    } catch (DataProviderException ex) {
            error(ex.getMessage());
            error(ex.getStackTrace().toString());
        
    }

       return null;
    }
    public String button1_action() {
        // TODO: Process the action. Return value is a navigation
        // case name where null will return to the same page.
       try{
        this.sesion_temp_gruposDataProvider.cursorFirst();
         this.getSessionBean1().select_temp_gruposDataProvider.cursorFirst();
        RowKey rk = tableRowGroup3.getRowKey();

        boolean data=sesion_temp_gruposDataProvider.canRemoveRow(rk);
        if(data== true)
        {sesion_temp_gruposDataProvider.removeRow(rk);
        sesion_temp_gruposDataProvider.commitChanges();
        sesion_temp_gruposDataProvider.refresh();

        }else
            error ("no se puede remover filas" );
        return null;

        } catch (DataProviderException ex) {
            error(ex.getMessage());
            error(ex.getStackTrace().toString());
        }
       return null;
    }

    public void select_temp_gruposDataProvider_rowAdded(TableDataProvider tdp, RowKey rk) {
    }

    public String tab2_action() {
        // TODO: Process the action. Return value is a navigation
        // case name where null will return to the same page.

        txtareades.setDisabled(true);
        return null;
    }







    
}

